package com.wcs.exam.controller.admin.req;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * Admin-考试-正式考试-保存-请求参数
 * </p>
 *
 * @author wcs
 * @since 2024-07-10
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "Admin-考试-正式考试-保存-请求参数")
public class AdminExamRegistrationSaveReq implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Size(max = 100, message = "考试名称不能超过100个字符")
    @NotBlank(message = "考试名称不能为空")
    @Schema(description = "考试名称(内容限制：1~100)", requiredMode = Schema.RequiredMode.REQUIRED)
    private String examName;

    @NotNull(message = "考试分类不能为空")
    @Schema(description = "分类ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long categoryId;

    @NotNull(message = "考试试卷不能为空")
    @Schema(description = "试卷ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long paperId;

    @Size(max = 200, message = "考试说明不能超过200个字符")
    @Schema(description = "考试说明(内容限制：<=200)")
    private String description;

    @DecimalMin(value = "0", message = "销售价不能小于0元")
    @DecimalMax(value = "99999", message = "销售价不能大于99999元")
    @NotNull(message = "销售价不能为空")
    @Schema(description = "销售价(单位：元，0表示免费)", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal price;

    @DecimalMin(value = "0", message = "划线价不能小于0元")
    @DecimalMax(value = "99999", message = "划线价不能大于99999元")
    @NotNull(message = "划线价不能为空")
    @Schema(description = "划线价(单位：元，0表示免费)", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal linePrice;

    @Min(value = 1, message = "考试答题时间不能小于1分钟")
    @Max(value = 300, message = "考试答题时间不能大于300分钟")
    @NotNull(message = "考试答题时间不能为空")
    @Schema(description = "作答时长(单位：分钟，内容范围：1~300)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer answerTime;

    @Min(value = 0, message = "考试及格百分比不能小于0%")
    @Max(value = 100, message = "考试及格百分比不能大于100%")
    @NotNull(message = "考试及格百分比不能为空")
    @Schema(description = "及格百分比(取值范围：0~100)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer passPercentage;

    @NotNull(message = "考试人脸识别设置不能为空")
    @Schema(description = "人脸识别(false：关闭、true：开启)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean faceId;

    @NotNull(message = "考试切屏限制设置不能为空")
    @Schema(description = "切屏限制(false：关闭、true：开启)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean switchScreenLimit;

    @Min(value = 0, message = "切屏次数不能小于0次")
    @Max(value = 20, message = "切屏次数不能大于20次")
    @Schema(description = "切屏限制次数(取值范围：0~20)")
    private Integer switchScreenCount;

    @Min(value = 1, message = "切屏判断时间不能小于1秒")
    @Max(value = 30, message = "切屏判断时间不能大于30秒")
    @Schema(description = "切屏判断时间(单位：秒，取值范围：1~30)")
    private Integer switchScreenTime;

    @NotNull(message = "考试评阅方式不能为空")
    @Schema(description = "评阅方式(1:系统评阅，2:人工评阅)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer evaluationMethod;

    @Schema(description = "AI评阅(false：关闭、true：开启)-默认：关闭")
    private Boolean aiGrading;

    @NotNull(message = "考试成绩设置不能为空")
    @Schema(description = "考试成绩设置(1：记录学员最高成绩、2：记录学员最新成绩)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer examScoreType;

    @Schema(description = "成绩展示规则(1：交卷后、2：考试结束后、3：自定义)-只能查看评阅完成的记录")
    private Integer resultShowRule;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Schema(description = "成绩展示时间")
    private LocalDateTime resultShowTime;

    @Schema(description = "作答内容展示(false：禁止、true：显示)-开启成绩显示才能开启")
    private Boolean answerShow;

    @Schema(description = "作答内容展示规则(1：查看对错和答案解析、2：只看对错)-只能查看评阅完成的记录")
    private Integer answerShowRule;

    @Schema(description = "结果显示名次(false：禁止、true：显示)-开启成绩显示才能开启")
    private Boolean resultShowRank;

    @NotNull(message = "排行榜设置不能为空")
    @Schema(description = "排行榜(false：禁止、true：显示)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean rankList;

    @NotNull(message = "报名开始时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Schema(description = "报名开始时间(格式：yyyy-MM-dd HH:mm)", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime registrationStartTime;

    @NotNull(message = "报名结束时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Schema(description = "报名结束时间(格式：yyyy-MM-dd HH:mm)", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime registrationEndTime;

    @Min(value = 0, message = "报名人数限制不能小于0人")
    @Max(value = 99999999, message = "报名人数限制不能大于99999999人")
    @NotNull(message = "报名人数限制不能为空")
    @Schema(description = "报名人数限制(0表示不限人数，内容范围：0~99999999)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer registrationUserLimitCount;

    @NotNull(message = "考试开始时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Schema(description = "考试开始时间(格式：yyyy-MM-dd HH:mm)", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime examStartTime;

    @Schema(description = "允许迟到(false：禁止、true：允许)-默认：false")
    private Boolean allowableLate;

    @Schema(description = "允许迟到时间(单位：分钟，不能大于答卷时间)")
    private Integer allowableLateTime;

    @Schema(description = "正式考试-考试开考前人脸识别限制时间(单位：分钟，内容范围：1~30)-默认：15")
    private Integer faceIdLimitTime;

    @Schema(description = "正式考试-考试开考前人脸识别允许错误次数(单位：次，内容范围：1~99)-默认：3")
    private Integer faceIdLimitCount;

    @Schema(description = "正式考试-考试开考前人脸识别失败允许考试(false：禁止、true：允许)-默认：false")
    private Boolean faceIdFailureEnter;

    @Schema(description = "正式考试-考试开考前人脸识别失败允许申诉(false：禁止、true：允许)-默认：false")
    private Boolean faceIdFailureAppeal;

    @NotNull(message = "考试人脸抓拍设置不能为空")
    @Schema(description = "人脸抓拍(false：关闭、true：开启)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean faceCapture;

    @Min(value = 1, message = "考试人脸抓拍时间不能小于1分钟")
    @Max(value = 30, message = "考试人脸抓拍时间不能大于30分钟")
    @Schema(description = "人脸抓拍时间(单位：分钟，取值范围：1~30)")
    private Integer faceCaptureTime;

    @Schema(description = "人脸抓拍检测(与开考前人脸识别结果进行对比)")
    private Boolean faceCaptureDetection;

    @Schema(description = "人脸抓拍高灵敏度检测(在考试过程中，以固定频率（例如3秒/次）监测学员摄像头中是否存在人脸或多张人脸)")
    private Boolean faceCaptureHighDetection;

    @Min(value = 1, message = "考试人脸抓拍检测失败次数不能小于1次")
    @Max(value = 99, message = "考试人脸抓拍检测失败次数不能大于99次")
    @Schema(description = "人脸抓拍检测错误限制次数(内容限制：1~99)")
    private Integer faceCaptureFailureCount;

    @Schema(description = "正式考试-开考前通知(false：禁止、true：开启)-默认：false")
    private Boolean noticeBefore;

    @Schema(description = "正式考试-成绩公布通知(false：禁止、true：开启)-默认：false")
    private Boolean noticePublishedScore;

    @Schema(description = "虚拟学习人数")
    private Integer countVirtualStudy;

    @Schema(description = "虚拟购买人数")
    private Integer countVirtualBuy;

    @Schema(description = "发布状态(0：未发布，1：已发布)")
    private Integer publishStatus;
}
